import threading
from PyQt4.QtCore import QObject
class KSingleton(QObject):
    def __init__():
        "disable the __init__ method"

    __inst = None # make it so-called private

    __lock = threading.Lock() # used to synchronize code

    @staticmethod
    def getInst():
        KSingleton.__lock.acquire()
        if not KSingleton.__inst:
            KSingleton.__inst = QObject.__new__(KSingleton)
            QObject.__init__(KSingleton.__inst)
        KSingleton.__lock.release()
        return KSingleton.__inst
